package cn.itcast.wanxinp2p.consumer.message;

import cn.itcast.wanxinp2p.common.domain.DepositoryConsumerResponse;
import cn.itcast.wanxinp2p.consumer.service.ConsumerService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Mq消息消费者，用来获取消息
 * 消息监听：①使用注解
 *    ②手动编码
 * @projectName wanxinp2p
 * @Description 　　* @param
 * 　　* @return
 */

@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer.group}", topic = "${rocketmq.tp-gateway-notify-agent.topic}",
        selectorExpression = "${rocketmq.tp-gateway-notify-agent.tag}")
@Component
public class GatewayNotifyConsumer implements RocketMQListener<DepositoryConsumerResponse> {

    @Autowired
    private ConsumerService consumerService;

    @Override
    public void onMessage(DepositoryConsumerResponse message) {
     //更新用户信息
        consumerService.modifyResult(message);
    }
}
